import "@site/src/languages/highlight";

# Size

**Description:**

&emsp;&emsp;A size object with a given width and height.

**Class Object:** [Size Class](/docs/api/Class%20Object/Size).

**Inherits from:** [ContainerItem](/docs/api/Class/ContainerItem).

## width

**Type:** Field.

**Description:**

&emsp;&emsp;The width of the size.

**Signature:**
```tl
width: number
```

## height

**Type:** Field.

**Description:**

&emsp;&emsp;The height of the size.

**Signature:**
```tl
height: number
```

## set

**Type:** Function.

**Description:**

&emsp;&emsp;Set the width and height of the size.

**Signature:**
```tl
set: function(self: Size, width: number, height: number)
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| width | number | The new width of the size. |
| height | number | The new height of the size. |

## equals

**Type:** Function.

**Description:**

&emsp;&emsp;Check if two sizes are equal.

**Signature:**
```tl
equals: function(self: Size, other: Size): boolean
```

**Usage:**
```tl
sizeA == sizeB or sizeC ~= sizeD
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| other | Size | The other size to compare to. |

**Returns:**

| Return Type | Description |
| --- | --- |
| boolean | Whether or not the two sizes are equal. |

## mul

**Type:** Function.

**Description:**

&emsp;&emsp;Multiply the size by a vector.

**Signature:**
```tl
mul: function(self: Size, vec: Dora.Vec2.Type): Size
```

**Usage:**
```tl
local halfSize = size * Vec2(0.5, 0.5)
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| vec | Vec2 | The vector to multiply by. |

**Returns:**

| Return Type | Description |
| --- | --- |
| Size | The result of multiplying the size by the vector. |

## __eq

**Type:** Metamethod.

**Description:**

&emsp;&emsp;Check if two sizes are equal.

**Signature:**
```tl
metamethod __eq: function(self: Size, other: Size): boolean
```

**Usage:**
```tl
sizeA == sizeB or sizeC ~= sizeD
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| other | Size | The other size to compare to. |

**Returns:**

| Return Type | Description |
| --- | --- |
| boolean | Whether or not the two sizes are equal. |

## __mul

**Type:** Metamethod.

**Description:**

&emsp;&emsp;Multiply the size by a vector.

**Signature:**
```tl
metamethod __mul: function(self: Size, vec: Dora.Vec2.Type): Size
```

**Usage:**
```tl
local halfSize = size * Vec2(0.5, 0.5)
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| vec | Vec2 | The vector to multiply by. |

**Returns:**

| Return Type | Description |
| --- | --- |
| Size | The result of multiplying the size by the vector. |